package com.groupalpha.helpers;

import java.util.List;

import RSS.RSSFeed;
import RSS.RSSItem;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.groupalpha.studentport.R;

public class MyArrayAdapter extends ArrayAdapter<RSSItem> {
public MyArrayAdapter(Context context, int textViewResourceId,
			List<RSSItem> objects) {
		super(context, textViewResourceId, objects);
		// TODO Auto-generated constructor stub
		c=context;
		array=objects;
	}

private Context c;
private List<RSSItem> array;

	 @Override
     public View getView(int position, View convertView, ViewGroup parent) {
             
      View row = convertView;
      if (row == null) {
			LayoutInflater inf = (LayoutInflater) c.getSystemService(c.LAYOUT_INFLATER_SERVICE);
			row = inf.inflate(R.layout.gasqlist, null);
		}
      if (row == null) {
       LayoutInflater inflater = LayoutInflater.from(c);
       row = inflater.inflate(R.layout.gasque, parent, false);
      }
      final int itemPosition = position;
       
      TextView datum = (TextView) row.findViewById(R.id.GasqDatum);
      datum.setText(array.get(position).getTitle());

      TextView descip = (TextView) row.findViewById(R.id.GasqDesc);
      descip.setText(array.get(position).getDescription());
      
      return row;
	 }

}
